export default {
    data(){
        return {
          tableData: [{ 
            name: 'A计划',
            code: 200333,
            dlProportion: '30%',
            dxProportion: '50%',
            isEnable: 1,
            dateEnable: '2018-05-02'
          }, {
            name: 'B计划',
            code: 200334,
            dlProportion: '35%',
            dxProportion: '55%',
            isEnable: 1,
            dateEnable: '2018-06-02'
          }],
          tableData1: [],
          ruleForm: {
            name: "",
            isEnable: ""
          },
          addForm: {
            name: "",
            isEnable: ""
          },
          currentPage4: 4,
          isEnableStatus: {"1":"是","2":"否"},
          addFormVisible: false
        }
      },
      methods: {
        //查询
        submitForm(formName) {
          console.log(formName);
          this.$refs[formName].validate(valid => {
              if (valid) {
                  alert("submit!");
              } else {
                  console.log("error submit!!");
                  return false;
              }
          });
        },
        //重置
        resetForm(formName) {
          this.$refs[formName].resetFields();
        },
        //关闭弹框
        handleClose(done) {
          this.$confirm("确认关闭？")
              .then(_ => {
                  done();
              })
              .catch(_ => {});
        },
        //新增
        save(formName){
          console.log(formName);
        },
        //评级设置
        levelSetting(index, row) {
          console.log(index, row);
        },
        //修改
        handleEdit(index, row) {
          console.log(index, row);
        },
        //浏览
        preview(index, row) {
          console.log(index, row);
        },
        //分配行业
        handleDistribution(index, row) {
          console.log(index, row);
        },
        handleSizeChange(val) {
          console.log(`每页 ${val} 条`);
        },
        handleCurrentChange(val) {
          console.log(`当前页: ${val}`);
        },
        formatData(val){
          console.log(val);
         return this.isEnableStatus[val.isEnable] 
        },
        // 增加行
        addRow() {
          var list = {
            code: this.code,
            name: this.name,
            type: this.type,
            enable: this.enable,
            remark: this.remark
          }
          this.tableData1.unshift(list)
        },
        handleDelete(index, row) {
            this.tableData1.splice(index, 1);
            console.log(index, row);
            console.log(this.tableData1);
        }
      }
}